package com.xyz.dao.logic;

import com.free.ext.mybatis.model.entity.PageResponseModel;
import com.xyz.dao.dao.SAnnouncementDao;
import com.xyz.domain.table.SAnnouncement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class SAnnouncementLogic {

    @Autowired
    private SAnnouncementDao sAnnouncementDao;

    public SAnnouncement add(SAnnouncement sAnnouncement){
        return sAnnouncementDao.insert(sAnnouncement);
    }

    public Integer update(SAnnouncement sAnnouncement){
        return sAnnouncementDao.update(sAnnouncement);
    }

    public List<SAnnouncement> list(SAnnouncement sAnnouncement, String orderBy){
        return sAnnouncementDao.selectList(sAnnouncement, orderBy);
    }

    public Integer delete(Integer key){
        return sAnnouncementDao.delete(key);
    }

    public PageResponseModel<SAnnouncement> pageInfo(SAnnouncement sAnnouncement, String orderBy, Integer pageNo, Integer pageSize){
        return sAnnouncementDao.selectByPageNo(sAnnouncement, orderBy, pageNo, pageSize);
    }

    public PageResponseModel<SAnnouncement> selectByPageNo(SAnnouncement condition, String orderBy, int pageNo, int pageSize) {
        return sAnnouncementDao.selectByPageNo(condition, orderBy, pageNo, pageSize);
    }
}